﻿using System;
using System.Windows;

namespace AdTech.Snap.Interop
{
    internal struct DisplayInfo
    {
        // Properties
        public bool IsPrimaryScreen { get; set; }
        public Rect Bounds { get; set; }
        public Rect WorkingArea { get; set; }

        public static implicit operator DisplayInfo(MONITORINFO monitorInfo)
        {
            return new DisplayInfo
            {
                IsPrimaryScreen = (monitorInfo.Flags & 1) != 0,
                Bounds = monitorInfo.Monitor,
                WorkingArea = monitorInfo.WorkArea
            };
        }

        public static implicit operator MONITORINFO(DisplayInfo displayInfo)
        {
            return new MONITORINFO
            {
                Flags = Convert.ToUInt32(displayInfo.IsPrimaryScreen),
                Monitor = displayInfo.Bounds,
                WorkArea = displayInfo.WorkingArea
            };
        }
    }
}
